package com.boot.service;

import com.boot.entity.Attachment;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springframework.http.ResponseEntity;
import org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBody;

import java.io.IOException;
import java.io.OutputStream;
import java.util.List;

/**
 * <p>
 * 附件表，用于存储与问题关联的上传文件信息 服务类
 * </p>
 *
 * @author bbyh
 * @since 2025-10-31
 */
public interface IAttachmentService extends IService<Attachment> {
    /**
     * 查询某问题下的所有附件（只返回 id 和 fileName）
     */
    List<Attachment> listAttachmentsByQuestionId(Long questionId);

    /**
     * 下载某个附件（实际是打包一个压缩包）
     */
    void streamDownloadAttachmentsAsZip(Long questionId, OutputStream outputStream) throws IOException;

    ResponseEntity<StreamingResponseBody> serveImage(String imageName) throws Exception;
}
